#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

/**
 * The exploit string that will be written to stdout
 *
 * \x is the escape character that makes gcc interpret the coming
 * characters as hexadecimal values (not as ASCII characters). The sequence of
 * bytes in "exploit" will exactly match the bytes you denote in hex (and thus
 * binary).
 *
 * 1 byte is represented with 2 hex numbers
 * 1 byte --> 8 bits --> [0 - 255] : [0000 0000 - 1111 1111] : [00 - FF]
 *
 * https://www.w3resource.com/convert/number/hex-to-binary.php
 *
 * So if we wanted to write 2 bytes of all 1s we would write
 *
 * "\xFF\xFF" --> 1111 1111 1111 1111
 *
 */
const char exploit[] = "\x00\x00\x00\x00\x00\x00\x00\x00"
                       "\x00\x00\x00\x00\x00\x00\x00\x00"
                       "\x00\x00\x00\x00\x00\x00\x00\x00"
                       "\x00\x00\x00\x00\x00\x00\x00\x00";

/**
 * Write the exploit bytes to stdout
 */
int main(int argc, char** argv) {
  // strings are null terminated so we write the sizeof the exploit string minus
  // 1 to only write out the bytes specified
  write(STDOUT_FILENO, exploit, sizeof(exploit) - 1);

  // free(e);
  return 0;
}
